import request from '../utils/request';
import logRequest from '../utils/requestNoToken';

// 登录
export const login = query => {
    return logRequest.post('/zsrencai/api/person/user/login', query);
};
// 注册
export const register = query => {
    return logRequest.post('/zsrencai/api/person/user/register', query);
};
// 退出登录
export const logout = () => {
    return request.get('/zsrencai/api/person/user/logout');
};
// 找回密码
export const findPassword = query => {
    return logRequest.post('/zsrencai/api/person/user/reset-pass-word', query);
};
// 发送邮箱验证码/zsrencai/api/sys/admin/mail/code
export const mailCode = query => {
    return logRequest.post('/zsrencai/api/sys/admin/mail/code', query);
};
// 检测图片验证码
export const captchaImg = query => {
    return logRequest.get('/zsrencai/api/sys/admin/captcha/validate', { params: query });
};
// 发送短信
export const postMsg = query => {
    return logRequest.post('/zsrencai/api/sys/admin/sms/code', query);
};
export const selectResumeList = () => {
    return request.get('/zsrencai/api/person/resume/selectResumeList');
};
export const selectResume = query => {
    return request.post('/zsrencai/api/person/resume/selectResume', query);
};

export const insertResume = query => {
    return request.post('/zsrencai/api/person/resume/insertResume', query);
};

export const insertTrain = query => {
    return request.post('/zsrencai/api/person/resumeEdit/insertTrain', query);
};

export const insertEducation = query => {
    return request.post('/zsrencai/api/person/resumeEdit/insertEducation', query);
};
export const insertWork = query => {
    return request.post('/zsrencai/api/person/resumeEdit/insertWork', query);
};
export const insertLanguage = query => {
    return request.post('/zsrencai/api/person/resumeEdit/insertLanguage', query);
};
export const insertSkill = query => {
    return request.post('/zsrencai/api/person/resumeEdit/insertSkill', query);
};
export const insertResumeAward = query => {
    return request.post('/zsrencai/api/person/resumeEdit/insertResumeAward', query);
};

export const deleteWork = query => {
    return request.get('/zsrencai/api/person/resumeEdit/deleteWork/' + query.id);
};
export const deleteEducation = query => {
    return request.get('/zsrencai/api/person/resumeEdit/deleteEducation/' + query.id);
};
export const deleteLanguage = query => {
    return request.get('/zsrencai/api/person/resumeEdit/deleteLanguage/' + query.id);
};
export const deleteSkill = query => {
    return request.get('/zsrencai/api/person/resumeEdit/deleteSkill/' + query.id);
};
export const deleteTrain = query => {
    return request.get('/zsrencai/api/person/resumeEdit/deleteTrain/' + query.id);
};
export const deleteResumeAward = query => {
    return request.get('/zsrencai/api/person/resumeEdit/deleteResumeAward/' + query.id);
};

export const deleteById = query => {
    return request.post('/zsrencai/api/person/resumeEdit/deleteById', query);
};

// navList查询
export const getNavList = query => {
    return request.get(`/zsrencai/api/ms/news-menu/list/${query}`, {}, { headers: { Authorization: '' } });
};

// 检测企业token
export const enterpriseToken = query => {
    return request.post('/zsrencai/api/company/company/selectcompanybyuserid', {}, { headers: { Authorization: 'Bearer ' + query } });
};
// 检测个人token
export const personalToken = query => {
    return personalRequest.get('/zsrencai/api/person/user/webValidatorLogin', { headers: { Authorization: 'Bearer ' + query } });
};
// 查看是否存在未读消息
export const checkMsg = () => {
    return request.get('/zsrencai/api/person/msg/read');
};
// 查看是否存在未读消息
export const checkChat = () => {
    return request.get('/zsrencai/ws/chat/getUnReadNum');
};
//获取二维码
export const getUserlogin = time => {
    return request.get(`zsrencai/api/person/user/wx/get/qrcode`);
};

//查看登录状态
export const wxLogin = time => {
    return logRequest.post(`/zsrencai/api/person/user/wx/login`, time);
};
